<?php
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2018/10/22
 * Time: 11:50
 */
namespace Admin\Controller;
use Think\Controller;
class GloginController extends Controller {
    public function index()
    {
        $this->display();
//        exit();
    }
    public function login(){
        $verify=new \Think\Verify();
        if($verify->check (I('verify'))==false){
            $this->error('验证码错误');
        }
        $user = M('author');
        $username = I('username');
        $pwd = md5(I('password'));
//        var_dump($username);
//        exit();
        if($user->where("`name`='$username' AND `password` ='$pwd'")->find()){
            session('name',$username);
            //跳转到IndexController控制器
            redirect(U('/Admin/Index/index'),0,"跳转中.....");
        }else{
//            echo $user->getLastSql();
//            exit();
            $this->error("用户名或密码错误！");
        }

    }
}